# Description:
#   Version 2 of the asymmetric hashing public API.

package(
    default_visibility = ["//visibility:public"],
    licenses = ["notice"],
)

# Libraries
##########################################################################

# If only indexing is required, we should not need to link to training, but
# only its headers.
cc_library(
    name = "training_options_base",
    srcs = ["training_options_base.cc"],
    hdrs = ["training_options_base.h"],
    tags = ["local"],
    deps = [
        "//scann/data_format:dataset",
        "//scann/distance_measures",
        "//scann/oss_wrappers:scann_threadpool",
        "//scann/projection:chunking_projection",
        "//scann/proto:hash_cc_proto",
        "//scann/utils:types",
    ],
)

cc_library(
    name = "training_options",
    srcs = ["training_options.cc"],
    hdrs = ["training_options.h"],
    tags = ["local"],
    deps = [
        ":training_options_base",
        "//scann/data_format:dataset",
        "//scann/distance_measures",
        "//scann/oss_wrappers:scann_threadpool",
        "//scann/projection:chunking_projection",
        "//scann/projection:projection_factory",
        "//scann/proto:hash_cc_proto",
        "//scann/proto:projection_cc_proto",
        "//scann/utils:types",
    ],
)

cc_library(
    name = "training_model",
    srcs = ["training_model.cc"],
    hdrs = ["training_model.h"],
    tags = ["local"],
    deps = [
        "//scann/data_format:datapoint",
        "//scann/data_format:dataset",
        "//scann/oss_wrappers:scann_status",
        "//scann/proto:centers_cc_proto",
        "//scann/proto:hash_cc_proto",
        "//scann/utils:common",
        "//scann/utils:types",
        "@com_google_absl//absl/strings",
    ],
)

cc_library(
    name = "training",
    hdrs = ["training.h"],
    tags = ["local"],
    deps = [
        ":training_model",
        ":training_options",
        "//scann/data_format:dataset",
        "//scann/hashes/internal:asymmetric_hashing_impl",
        "//scann/hashes/internal:stacked_quantizers",
        "//scann/oss_wrappers:scann_aligned_malloc",
        "//scann/oss_wrappers:scann_down_cast",
        "//scann/oss_wrappers:scann_threadpool",
        "//scann/oss_wrappers:tf_dependency",
        "//scann/utils:types",
        "@com_google_absl//absl/base",
        "@com_google_absl//absl/flags:flag",
        "@com_google_absl//absl/log",
    ],
)

cc_library(
    name = "indexing",
    srcs = ["indexing.cc"],
    hdrs = ["indexing.h"],
    tags = ["local"],
    deps = [
        ":training_model",
        "//scann/data_format:datapoint",
        "//scann/distance_measures",
        "//scann/distance_measures/one_to_one:dot_product",
        "//scann/distance_measures/one_to_one:l1_distance",
        "//scann/distance_measures/one_to_one:l2_distance",
        "//scann/hashes/internal:asymmetric_hashing_impl",
        "//scann/hashes/internal:stacked_quantizers",
        "//scann/oss_wrappers:scann_serialize",
        "//scann/oss_wrappers:scann_status",
        "//scann/projection:chunking_projection",
        "//scann/proto:hash_cc_proto",
        "//scann/utils:common",
        "//scann/utils:reduction",
        "//scann/utils:types",
        "//scann/utils:util_functions",
        "@com_google_absl//absl/base:core_headers",
    ],
)

cc_library(
    name = "querying",
    srcs = ["querying.cc"],
    hdrs = ["querying.h"],
    tags = ["local"],
    deps = [
        ":training",
        ":training_options",
        "//scann/base:restrict_allowlist",
        "//scann/base:search_parameters",
        "//scann/data_format:datapoint",
        "//scann/data_format:dataset",
        "//scann/distance_measures",
        "//scann/hashes/internal:asymmetric_hashing_impl",
        "//scann/hashes/internal:asymmetric_hashing_lut16",
        "//scann/hashes/internal:asymmetric_hashing_postprocess",
        "//scann/projection:chunking_projection",
        "//scann/proto:hash_cc_proto",
        "//scann/utils:common",
        "//scann/utils:top_n_amortized_constant",
        "//scann/utils:types",
        "//scann/utils:util_functions",
        "//scann/utils/intrinsics:flags",
        "@com_google_absl//absl/flags:flag",
        "@com_google_absl//absl/types:span",
    ],
)

cc_library(
    name = "searcher",
    srcs = [
        "searcher.cc",
        "searcher_mutator.cc",
    ],
    hdrs = ["searcher.h"],
    tags = ["local"],
    deps = [
        ":indexing",
        ":querying",
        ":serialization",
        ":training",
        "//scann/base:search_parameters",
        "//scann/base:single_machine_base",
        "//scann/data_format:datapoint",
        "//scann/data_format:dataset",
        "//scann/distance_measures",
        "//scann/hashes/internal:asymmetric_hashing_postprocess",
        "//scann/oss_wrappers:scann_serialize",
        "//scann/oss_wrappers:scann_status",
        "//scann/oss_wrappers:tf_dependency",
        "//scann/proto:hash_cc_proto",
        "//scann/tree_x_hybrid:leaf_searcher_optional_parameter_creator",
        "//scann/utils:common",
        "//scann/utils:datapoint_utils",
        "//scann/utils:top_n_amortized_constant",
        "//scann/utils:types",
        "//scann/utils:util_functions",
        "@com_google_absl//absl/base",
        "@com_google_absl//absl/status",
    ],
)

cc_library(
    name = "serialization",
    hdrs = ["serialization.h"],
    tags = ["local"],
    deps = [
        "//scann/data_format:datapoint",
        "//scann/data_format:dataset",
        "//scann/proto:centers_cc_proto",
        "//scann/proto:hash_cc_proto",
    ],
)

# Tests
##########################################################################
